import request from '@/config/axios'

export interface TeacherClassVO {
  id: number
  teacherId: number
  classId: number
  relation: string
  status: number
  stageId: number
  beginYear: number
  beginDate: Date
  endDate: Date
}

export interface BindTeacherClassVO {
  teacherId: number
  classesIds: number[]
}

// 查询教师班级分页
export const getTeacherClassPage = async (data) => {
  return await request.post({ url: `/cmis/teacher-class/page`, data })
}
// 查询教师班级列表
export const getTeacherClassList = async (data) => {
  return await request.post({ url: `/cmis/teacher-class/query`, data })
}

// 查询教师班级详情
export const getTeacherClass = async (id: number) => {
  return await request.get({ url: `/cmis/teacher-class/get?id=` + id })
}

// 新增教师班级
export const createTeacherClass = async (data: TeacherClassVO) => {
  return await request.post({ url: `/cmis/teacher-class/create`, data })
}

// 修改教师班级
export const updateTeacherClass = async (data: TeacherClassVO) => {
  return await request.put({ url: `/cmis/teacher-class/update`, data })
}

// 删除教师班级
export const deleteTeacherClass = async (id: number) => {
  return await request.delete({ url: `/cmis/teacher-class/delete?id=` + id })
}
// 批量删除教师班级
export const batchDeleteTeacher = async (ids: Array<string>) => {
  return await request.delete({ url: `/cmis/teacher-class/batchDelete?ids=` + ids })
}

// 导出教师班级 Excel
export const exportTeacherClass = async (params) => {
  return await request.download({ url: `/cmis/teacher-class/export-excel`, params })
}

// 下载教师班级 Excel模版
export const importTemplate = async () => {
  return await request.download({ url: `/cmis/teacher-class/get-import-template` })
}

// 导入教师班级 Excel
export const importTeacherClass = async (data) => {
  return await request.upload({ url: `/cmis/teacher-class/import-excel`, data: data })
}

// 绑定教师班级
export const bindTeacherClass = async (data: BindTeacherClassVO) => {
  return await request.post({ url: `/cmis/teacher-class/bind`, data })
}
